const express=require("express")
const app=express()
const path=require("path")
const cors=require("cors")
const bodyParser=require("body-parser")
const router = require("./routes/router")



//允许跨域
app.use(cors())
//允许发送json文件和post请求的配置
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended:false}))


    


//配置路由
app.use(router)
//挂载静态资源
app.use(express.static(path.join(__dirname,"public/banner")))
app.use(express.static(path.join(__dirname,"public/images")))
app.use(express.static(path.join(__dirname,"public/videos")))
app.use(express.static(path.join(__dirname,"public/images/userImg")))
app.listen(8889,()=>{
      console.log("8888:服务器开启成功")


})